<?php

class Viewer extends PrspLibrary{
	
	private static $viewer;
	
	public function initial(){}
	
	public function getSelfPluginId(){
		$pluginId = str_replace(PLUGINS_PATH, '', __FILE__);
		return substr($pluginId,1,strpos($pluginId, '/', 2)-1);
	}

	/**
	 * Set viewer
	 *
	 * @param IViewer viewer
	 */
	public function setViewer( $viewer ){
		if( !is_object($viewer) ){
			Logger::error('Viewer is invalide');
		}else{
			$reflectionClass = new ReflectionClass(get_class($viewer));
			$interfaces = $reflectionClass->getInterfaces();
			if( count($interfaces)>0 && isset($interfaces['IViewer']) ){
				Viewer::$viewer = $viewer;
			}
		}
	}
	
	/**
	 * Render viewer
	 *
	 */
	public static function render() {
		Viewer::$viewer->render();
	}
	
}

?>